<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>产品查询</title>
    <link rel="stylesheet" href="/box/layui/css/layui.css">
    <script src="/box/js/jquery-3.3.1.js"></script>
    <script src="/box/layui/layui.js"></script>
    <script src="/box/js/config.js"></script>
    <link rel="shortcut icon" href="/box/assets/ico/minus.png">
    <style>
        .box-pad {
            padding: 1%
        }
    </style>
</head>

<body>
    <div class="box-pad">
        <h1>产品查询</h1>
        <hr>
        <form class="layui-form" id="topForm" lay-filter="topForm">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">名称：</label>
                    <div class="layui-inline">
                        <input type="text" id="goodsName" class="layui-input" autocomplete="off">
                    </div>
                </div>
                <button type="button" class="layui-btn" style="margin-bottom: 10px" onclick="query()">查询</button>
            </div>
        </form>
        <table class="layui-table" lay-filter="goodsTable" lay-data="{id: 'goodsTable',text: {none: '没有查到相关数据'} , url: 'http://localhost:8888/goods/list',page: true,limit: 10,even: true}">
            <thead>
            <th lay-data="{field:'goodsId', width:60}">编号</th>
            <th lay-data="{field:'goodsName'}">名称</th>
            <th lay-data="{field:'company'}">单位</th>
            <th lay-data="{field:'money'}">单价（元）</th>
            <th lay-data="{field:'remarks'}">备注</th>
            </thead>
        </table>
        <script>
            var table;
            layui.use(['table','form'], function () {
                table = layui.table;
                var form = layui.form;
            });

            function query() {
                table.reload("goodsTable",{
                    page: {
                        //  从第一页开始
                        curr: 1
                    }
                    ,where: {
                        goodsName : $("#goodsName").val()
                    }
                });
            }
        </script>
    </div>
</body>
</html>